package part16;

import java.util.Arrays;

/**
 * @author wcj
 * @Date 2021/5/31 17:29
 * @Version 1.0
 */
public class Part168 {

    /**
     * Arrays.fill()填充数组
     * System.arraycopy()将数组从第几个元素开始复制length长度元素到B数组
     * arraycopy()函数基本类型数组和对象数组都可以复制，只不过对象数组复制的是引用而已
     *
     * @param args
     */
    public static void main(String[] args) {

        int[] i = new int[5];
        int[] j = new int[10];
        Arrays.fill(i, 47);
        Arrays.fill(j, 99);
        System.out.println(Arrays.toString(i));
        System.out.println(Arrays.toString(j));
        System.arraycopy(i, 0, j, 0, i.length);
        System.out.println(Arrays.toString(j));

        Integer[] a = new Integer[5];
        Integer[] b = new Integer[10];
        Arrays.fill(a, new Integer(47));
        Arrays.fill(b, new Integer(99));
        System.arraycopy(a, 0, b, 0, a.length);
        System.out.println(Arrays.toString(b));
    }
}
